﻿@using Model.Util;
@using Xproject.Util;
@{
    Layout = "~/Views/Shared/_JSlayout.cshtml";
    string Domain = CommonHelper.GetAppSettings("Domin");
}
@model Category


<title>添加商品分类</title> 
<link href="~/Content/categoryCss/site.css" rel="stylesheet" />  

<script type="text/javascript">
    $(document).ready(function () {
        var optionsNew = {
            beforeSubmit: function () {
                //layer.open({ type: 2, time: 2 });
                layer.load(1, { shade: [0.1, '#000'], time: 2000 });
            },
            success: function (data) {
                if (data.Success == true) {
                    layer.alert('编辑成功', { icon: 1, skin: 'layer-ext-moon', time: 2000 });
                } else {
                    layer.alert(data.Data, { icon: 1, skin: 'layer-ext-moon', time: 2000 });
                }
            },
            error: function () {
                alert(JSON.stringify(data));
            },
            type: "post",
            clearForm: false,
            timeout: 100000
        };

        $("#CategoryForm").submit(function () {
            $("#CategoryForm").ajaxSubmit(optionsNew);// type="button"
            return false;
        });
    });

     
</script>
<h1 class="rightH1">
    分类管理 &gt;&gt; 添加分类
    <div class="right">
        <a href="@(Domain)/Category/CategoryList" class="menuBT">
            <img src="../../content/images/goback.jpg" />返回列表
        </a>
        <div class="clear">
        </div>
    </div>
    <div class="clear">
    </div>
</h1>
<div class="addTable">
    <form class="form-horizontal m-t" id="CategoryForm" action="~/Category/AddCategory" method="post">
        <table width="100%">
            <tr>
                <td width="76px" align="right">
                    分类名称：
                </td>
                <td>
                    <input class="form-control" name="Name"  value="@(Model!=null?Model.Name:"")" required/>                  
                </td>
            </tr>
            <tr>
                <td align="right">
                    所属分类：
                </td>
                <td>
                    <select data-val="true" data-val-number="字段 ParentCateId 必须是一个数字。" data-val-range="请选择分类" data-val-range-max="2147483647" data-val-range-min="0" data-val-required="ParentCateId 字段是必需的。" id="ParentId" name="ParentId">
                        <option @if (0 == Model.ParentId) { <text> selected="selected" </text> }
                                value="0">
                            顶层分类
                        </option>
                        @foreach (Category info in ViewData["categoryList"] as List<Category>)
                        {
                            <option @if (info.CategoryID == Model.ParentId) { <text> selected="selected" </text> }
                                    value="@info.CategoryID">
                                @Html.Raw(CommonHelper.GetHtmlBS(info.Layer - 1)) @info.Name
                            </option>
                        }
                    </select>
                    
                </td>
            </tr>
            <tr>
                <td align="right">
                    价格区间：
                </td>
                <td>
                    <div class="left">
                        <textarea class="form-control" cols="25" rows="10" name="PriceRange"></textarea>                    
                    </div>
                    <div class="left">
                        <br />
                        <br />
                       
                        <br />
                        (1)：每一行为一个价格筛选，用回车分隔
                        <br />
                        (2)：价格筛选有两种格式。一种为“开始价格-结束价格”用"-"分隔；另一种为只有“开始价格”
                    </div>
                    <div class="clear"></div>
                </td>
            </tr>
            <tr>
                <td align="right">
                    排序：
                </td>
                <td>
                    <input  class="form-control" name="DisplayOrder" value="@(Model!=null?Model.DisplayOrder:0)"/>
                    
                </td>
            </tr>
            <tr>
                <td align="right">
                    &nbsp;
                </td>
                <td>
                    <button href="" class="addBt" id="sumbitBut" type="submit">
                        <img src="../../content/images/submit.jpg" />
                    </button>
                    
                </td>
            </tr>
            
        </table>
        </form>
</div>

